Skip to content

Added Parser Initialization Code#2

Merged
PranavVerma-droid merged 12 commits intomasterfrom
parser-init
Jul 10, 2025
Merged

Added Parser Initialization Code#2
PranavVerma-droid merged 12 commits intomasterfrom
parser-init

Conversation

@PranavVerma-droid
Copy link
Member

This pull request introduces a parser and an Abstract Syntax Tree (AST) to the project, enabling the transformation of tokens into structured representations. The changes include the addition of a new Parser module, the implementation of an AST in src/ast.rs, and updates to the main program to integrate these components.

Parser and AST Implementation:

  • Added src/ast.rs to define the AST structure, including Program, Statement, and Expression types, as well as support for constructs like LetStatement, WhenStatement, FunctionDef, and BinaryOperation.
  • Introduced the Parser module in src/parser.rs, which parses tokens into an AST. It includes methods for handling statements (parse_statement) and expressions (parse_expression) with support for constructs like let, show, when, and function definitions.

Integration into the Main Program:

  • Updated src/main.rs to include the parser and ast modules and integrate the parsing step into the main execution flow. This includes creating a Parser instance, generating the AST, and printing it for debugging purposes. [1] [2]

@PranavVerma-droid PranavVerma-droid merged commit a76ef26 into master Jul 10, 2025
4 checks passed
@PranavVerma-droid PranavVerma-droid deleted the parser-init branch July 10, 2025 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant